<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>车辆路线地图显示</title>
    <link rel="stylesheet" href="../../../../start/layui/css/layui.css" media="all">
    <script src="//api.map.baidu.com/api?type=webgl&v=1.0&ak=rth4FHH6vRGlq2GRv5hvKbM6cGfq0dzu"></script>
    <style type="text/css">
        body, html {
            width: 100%;
            height: 100%;
            margin:0;
            font-family:"微软雅黑";
        }
        #container{
            width:100%;
            height:100%;
        }
        #result{
            position: fixed;
            top: 10px;
            left: 20px;
            width: 300px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            background: #fff;
            box-shadow: 0 2px 6px 0 rgba(27, 142, 236, 0.5);
            border-radius: 7px;
            z-index: 99;
        }
    </style>
</head>
<body>
<div id="container"></div>
<div id='result'>TMS物流系统车辆路线</div>
<input type="hidden" id="mapId">
</body>
</html>
<script src="../../../../start/layui/layui.js"></script>
<script>
    layui.use(['table', 'form', 'jquery', 'layer', 'tree','util'], function () {
        var tree = layui.tree
            ,$ = layui.jquery
            ,table = layui.table
            ,util = layui.util
            ,form = layui.form
            ,layer = layui.layer;
        var map = new BMapGL.Map("container");
        setTimeout(function () {
            $.post("../../../../DriverMap", { "mapId": $("#mapId").val() },
                function(data){


                    map.centerAndZoom(new BMapGL.Point(data[0].iPX,data[0].iPY),11);
                    var p1 = new BMapGL.Point(data[0].iPX,data[0].iPY);
                    var p2 = new BMapGL.Point(data[1].iPX,data[1].iPY);
                    /*map.centerAndZoom(new BMapGL.Point(116.301934,39.977552),11);
                    var p1 = new BMapGL.Point(111.542763213,27.2642237601);
                    var p2 = new BMapGL.Point(113.012332278,28.1420471725);*/
                    var driving = new BMapGL.DrivingRoute(map, {renderOptions:{map: map, autoViewport: true}});
                    driving.search(p1, p2);
                }, "json");
        },500);




    })
</script>